package com.hl.toolkit.server.tycoin.news.slaveservice;

import com.tycoin.common.bean.PageInfo;
import com.tycoin.common.repository.AbstractRepository;
import com.tycoin.common.service.AbstractService;
import com.tycoin.news.slaveentity.TycoinNews;
import com.tycoin.news.slaverepository.TycoinNewsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(value = "slaveTransactionManager", readOnly = true)
public class TycoinNewsService   extends AbstractService<TycoinNews, Long> {

	@Autowired
	private TycoinNewsRepository tycoinNewsRepository;

	@Override
	public AbstractRepository<TycoinNews, Long> getRepository() {
		// TODO Auto-generated method stub
		return tycoinNewsRepository ;
	}
		
	public List<TycoinNews> queryByPage(int newsType,PageInfo pageInfo) {
  	
		org.springframework.data.domain.Page<TycoinNews> pageList=tycoinNewsRepository.queryTycoinNewsRepositoryByStatusAndNewsType(newsType, pageInfo.getPageRequest());

		return pageList.getContent();
	}
	
 
	 
	
}
	
	

